import {FLAG_STORAGE} from '../expand/dao/DataStore'


export default class FavoriteUtil {
    /**
     * favoiriteIcon单机回调函数
     * @param favoriteDao
     * @param item
     * @param isFavorite
     * @param flag
     */
    static onFavorite(favoriteDao, item, isFavorite, flag) {
        console.log('favoriteDao:::',favoriteDao)
        console.log('flag:::', flag)
        console.log('item:::', item)
        const key = flag === FLAG_STORAGE.flag_trending ? item.fullName : item.id.toString()
        console.log('key:::', key)
        if (isFavorite) {
            favoriteDao.saveFavoriteItem(key, JSON.stringify(item))
        } else {
            favoriteDao.removeFavoriteItem(key)
        }
    }
}